Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


meshchatx/src/frontend/public/rnode-flasher/README.md v4.4.0 (9b7aca4d) Text, 3.80 KB

Tc9d1d9# RNode Flasher

A _work-in-progress_ web based firmware flasher for [Tff7b72Reticulum](Te6edf3https://github.com/markqvist/Reticulum) / [Tff7b72RNode_Firmware](Te6edf3https://github.com/markqvist/RNode_Firmware).

Tff7b72- It is written in javascript and uses the [Tff7b72Web Serial APIs](Te6edf3https://developer.mozilla.org/en-US/docs/Web/API/Web_Serial_API).
Tff7b72- It supports putting relevant devices into DFU mode.
Tff7b72- It supports flashing firmware from a zip file.

At this time, it does not support flashing bootloaders or softdevices for the nRF boards.

Tc9d1d9## How does it work?

I wanted something simple, for flashing RNode firmware to a nRF52 RAK4631 in a web browser.

So, I spent a bit of time working through the source code of [Tff7b72adafruit-nrfutil](Te6edf3https://github.com/adafruit/Adafruit_nRF52_nrfutil) and wrote a javascript implementation of [Tff7b72dfu_transport_serial.py](Te6edf3https://github.com/adafruit/Adafruit_nRF52_nrfutil/blob/master/nordicsemi/dfu/dfu_transport_serial.py)

Generally, you would use the following command to flash a firmware.zip to your device;

Ta5d6ff```
adafruit-nrfutil dfu serial --package firmware.zip -p /dev/cu.usbmodem14401 -b 115200 -t 1200
```

The [Tff7b72nrf52_dfu_flasher.js](Te6edf3js/nrf52_dfu_flasher.js) in this project implements a javascript, web based version of the above command.

There was an existing package called [Tff7b72pc-nrf-dfu-js](Te6edf3https://github.com/NordicSemiconductor/pc-nrf-dfu-js), however this repo had been archived and didn't appear to support the latest DFU protocol.

Tc9d1d9## How to use it?

Tff7b72- Open https://liamcottle.github.io/rnode-flasher/ in your web browser.
Tff7b72- Select your device.
Tff7b72- Put your device into DFU mode (for nRF52 boards)
Tff7b72- Select a firmware file and click flash.
Tff7b72- Once flashed, your device should reboot into the new firmware.
Tff7b72- For new devices that have never been provisioned, you should click "Provision" to configure the EEPROM.
Tff7b72- Every time you flash new firmware, you should also click "Set Firmware Hash".

Tff7b72> Note: At this time, firmware hashes for RNode are not automatically configured.

Tc9d1d9## What is needed to set up a new RNode?

Tff7b72> Note: This is a technical overview of how the RNode device provisioning works.
Tff7b72> Most of this is taken care of by the code base, and this section just makes it easier to understand what is going on.

To set up a new RNode device, you will need to do a few things;

Tff7b72- Obtain supported hardware, such as a RAK4631
Tff7b72- Obtain an RNode firmware file
Tff7b72- Put your device into DFU mode
Tff7b72- Flash the firmware file
Tff7b72- Provision the EEPROM

Once the firmware is flashed to the device, you will need to provision the EEPROM;

Tff7b72- Set firmware hash in eeprom
Tff7b72- Collect device info
Tff7b72- Ta5d6ff`product`
Tff7b72- Ta5d6ff`model`
Tff7b72- Ta5d6ff`hardware_revision`
Tff7b72- Ta5d6ff`serial_number`
Tff7b72- Ta5d6ff`made` (unix timestamp of device creation)
Tff7b72- Write device info to eeprom
Tff7b72- Create an MD5 checksum of the device info
Tff7b72- Write 16 byte device info checksum to eeprom
Tff7b72- Sign device info checksum with signing key to use as signature
Tff7b72- Write 128 byte signature to eeprom
Tff7b72- Write Ta5d6ff`ROM.INFO_LOCK_BYTE` to Ta5d6ff`ROM.ADDR_INFO_LOCK` in eeprom
Tff7b72- Read eeprom and validate checksums and signatures to ensure all is correct

Tc9d1d9## TODO

Tff7b72- support configuring eeprom with device signatures and firmware hashes
Tff7b72- support flashing existing firmware files from api
Tff7b72- calculate on air bitrate based on tnc settings
Tff7b72- try using [Tff7b72web-serial-polyfill](Te6edf3https://github.com/google/web-serial-polyfill) to support flashing from Android device?

Tc9d1d9## License

MIT

Tc9d1d9## References

Tff7b72- https://github.com/adafruit/Adafruit_nRF52_nrfutil
Tff7b72- https://github.com/adafruit/Adafruit_nRF52_nrfutil/blob/master/nordicsemi/dfu/dfu_transport_serial.py
Tff7b72- https://github.com/markqvist/RNode_Firmware/blob/master/RNode_Firmware.ino
Tff7b72- https://github.com/markqvist/RNode_Firmware/blob/master/Framing.h
Tff7b72- https://github.com/markqvist/RNode_Firmware/blob/master/Utilities.h


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────